﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="FireZoneGroupEntry.aspx.cs"
    Inherits="MTRC.ODMS.Web.SOM.CodeSetup.FireZoneGroupEntry" %>

<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<%@ Register Src="~/UserControl/Menu/PageFoot.ascx" TagName="PageFoot" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/TabStrip.ascx" TagName="TabStrip" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/PageHead.ascx" TagName="PageHead" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="WebStructure" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Operational Data Management System</title>
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" />
    <link href="../../CSS/common.css" rel="stylesheet" type="text/css" />
    <link href="~/CSS/Menu.css" rel="stylesheet" type="text/css" />

    <script language="javascript" src="../../Javascript/CommonFunction.js"></script>

    <script language="javascript">
        function CheckData(SOM_FireLinkValidation,SOM_FireZoneGroupValidation,SOM_RowNoValidation,SOM_SeqNoValidation,SOM_EffectiveFromValidation,SOM_EffectiveToValidation,message)
        { 
             if(document.getElementById("ddlFireLink").selectedIndex==0)
            {
                alert(SOM_FireLinkValidation);
                document.getElementById("txtZoneGroup").focus();
                return false;
            }
            else if(trim(document.getElementById("txtZoneGroup").value)=="")
            {
                alert(SOM_FireZoneGroupValidation);
                document.getElementById("txtZoneGroup").focus();
                return false;
            }
            else if(trim(document.getElementById("txtRowNo").value)=="")
            {
                alert(SOM_RowNoValidation);
                document.getElementById("txtRowNo").focus();
                return false;
            }
            else if(trim(document.getElementById("txtSeqNo").value)=="")
            {
                alert(SOM_SeqNoValidation);
                document.getElementById("txtSeqNo").focus();
                return false;
            }
            else if(trim(document.getElementById("dtbEffectiveFrom$dateTextBox").value)=="")
            {//arrivalDate=document.getElementById("dtbArrivalStationTime$dateTextBox").value;
                alert(SOM_EffectiveFromValidation);
                document.getElementById("dtbEffectiveFrom$dateTextBox").focus();
                return false;
            }
            else if(trim(document.getElementById("dtbEffectiveTo$dateTextBox").value)=="")
            {
                alert(SOM_EffectiveToValidation);
                document.getElementById("dtbEffectiveTo$dateTextBox").focus();
                return false;
            }
            
            if(document.getElementById("chkVoid").checked==true)
            {
                if(confirm(message))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
    
//        function Void(message)
//        {
//            if(document.getElementById("chkVoid").checked==true)
//            {
//                if(confirm(message))
//                {
//                    return true;
//                }
//                else
//                {
//                    return false;
//                }
//            }
//            return true;
//        }
        
        
        
        
        
        
function TrimZero(strval)
        {
            if (strval.substring(0,1)=="0")
              {
                   strval=strval.substr(1);
                   strval=TrimZero(strval);
               }
            return strval;
        }
        
        function IsInteger(val)
        {
	        var re;
	        //re = /^[0-9]*[1-9][0-9]*$/;
	        re = /^[0-9]*$/;
	        return re.exec(val);	        
        }
        
//-------------------------- modify by zengshunbo 2009-02-20 -----------------------------
        
// function CheckCtlNo(obj)
//        {
//          //onkeyup="this.value=this.value.replace(/\D/g,'')" 
//          if (obj.value!="")
//          {
//                if (!IsInteger(obj.value))
//                {         
//                  obj.value=obj.title;       
//                  return false;
//                }
//                
//                if (obj.value.length>=2)
//                {
//                     obj.value=TrimZero(obj.value);         
//                }
//                
//                if(obj.value=="0")
//                {
//                    obj.value="";
//                    obj.focus();
//                    return false;
//                }
//                 
//          
////                if (parseInt(obj.value)>32767)
////                {    
////                
////                      if(obj.id=="txtRowNo")
////                      {
////                        alert(document.getElementById("txtHideRowNoOverFlow").value);
////                      }
////                      else
////                      {
////                        alert(document.getElementById("txtHideSeqNoOverFlow").value);
////                      }
////                      obj.value=obj.title;
////                      obj.focus();
////                      
////                      return false;
////                }
////                else
////                {
//                     if(obj.id=="txtRowNo")
//                     {
//                        if(parseInt(obj.value)>parseInt(document.getElementById("txtHideRowNoSysParameter").value))
//                        {
//                            alert(document.getElementById("txtHideRowNoSysParameterValidation").value + " " + document.getElementById("txtHideRowNoSysParameter").value);
//                            obj.value=obj.title;
//                            obj.focus();
//                            return false;
//                        }
//                     }
//                     else if(parseInt(obj.value)>parseInt(document.getElementById("txtHideSeqNoSysParameter").value))
//                     {
//                            alert(document.getElementById("txtHideSeqNoSysParameterValidation").value + " " + document.getElementById("txtHideSeqNoSysParameter").value);
//                            obj.value=obj.title;
//                            obj.focus();
//                            return false;
//                     }
//                
//                      return true;
////                }  

//                           
//          }
//          else
//             return true;
//          
//        }

//---------------------- End modify by zengshunbo 2009-02-20 -----------------------------

        
//------------------------ Add by zengshunbo 2009-02-20 -----------------------------

        function RowNoCheck(sender)
        {
            if( parseInt(sender.value)<1 || parseInt(sender.value) > parseInt(document.getElementById("txtHideRowNoSysParameter").value))
            {
                sender.value="";
                sender.focus();
            }
        }
        
        function SeqNoCheck(sender)
        {
            if( parseInt(sender.value)<1 || parseInt(sender.value) > parseInt(document.getElementById("txtHideSeqNoSysParameter").value))
            {
                sender.value="";
                sender.focus();
            }
        }
        
//------------------------ End add by zengshunbo 2009-02-20 -----------------------------

        function KeyDown(obj) 
        {     
           //alert(window.event.keyCode);
           
           if(window.event.keyCode==17 || window.event.keyCode==16)//17-Ctrl,16-shift
           {
                //event.keyCode=0;
                return false;		
           }
           
           if((window.event.keyCode==8) || (window.event.keyCode==46) || (window.event.keyCode==37) || (window.event.keyCode==38) || (window.event.keyCode==39) || (window.event.keyCode==40))
           {
              return true;
           }
          
           if((window.event.keyCode>=48 && window.event.keyCode<=57) || (window.event.keyCode>=96 && window.event.keyCode<=105))        
            {              
                return true;
            }
            else
            {	
                event.keyCode=0;
                return false;		    	
            }	
        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
        <AjaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
        </AjaxControlToolkit:ToolkitScriptManager>
        <table border="0" cellpadding="0" cellspacing="0" class="Page_Container">
            <tr>
                <td colspan="2" class="Page_Head">
                    <WebStructure:PageHead ID="PageHead" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="Page_Left">
                    <WebStructure:MainMenu ID="MainMenu" runat="server" AppPath="../../" CurrMenuID="M140911" />
                </td>
                <td class="Page_Right">
                    <table class="Page_Contents">
                        <tr>
                            <td class="TabStrip">
                                <WebStructure:TabStrip ID="TabStrip" CurrMenuID="M140809" ParentMenuID="M140911" DMenuMode="CurrOnly"
                                    runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td class="Contents" style="height: 16px">
                                <!--**********context Begin *****************-->
                                <div style="display: none;">
                                    <asp:TextBox runat="server" ID="txtHideRowNoOverFlow"></asp:TextBox>
                                    <asp:TextBox runat="server" ID="txtHideSeqNoOverFlow"></asp:TextBox>
                                    <asp:TextBox runat="server" ID="txtHideRowNoSysParameter"></asp:TextBox>
                                    <asp:TextBox runat="server" ID="txtHideSeqNoSysParameter"></asp:TextBox>
                                    <asp:TextBox runat="server" ID="txtHideRowNoSysParameterValidation"></asp:TextBox>
                                    <asp:TextBox runat="server" ID="txtHideSeqNoSysParameterValidation"></asp:TextBox>
                                </div>
                                <div id="div_CodeSetup_Title" style="display:none;">
                                    <asp:Label ID="lbl_CodeSetupTitle" runat="server" Font-Bold="true" Text="Code setup: Work Catogory"></asp:Label></div>
                          
                                <fieldset width="100%">
                                    <legend class="Title1">
                                        <asp:Label ID="lblTitleFireZoneGroupEntry" runat="server" Text="CategoryEntry"></asp:Label></legend>
                                    <table width="100%">
                                        <tr>
                                            <td style="width: 174px; height: 29px;">
                                                <asp:Label ID="lblFireLink" runat="server" Text="FireLink"></asp:Label><em>*</em>
                                            </td>
                                            <td style="width: 103px; height: 29px">
                                                <asp:DropDownList ID="ddlFireLink" runat="server">
                                                </asp:DropDownList>
                                            </td>
                                            <td style="width: 155px; height: 29px">
                                                &nbsp;</td>
                                            <td style="height: 29px; width: 118px;">
                                                <asp:HiddenField ID="hidID" runat="server" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 174px">
                                                <asp:Label ID="lblZoneGroup" runat="server" Text="ZoneGroup"></asp:Label><em><span
                                                    style="color: #ff0000">*</span></em> <em></em>
                                            </td>
                                            <td colspan="3">
                                                <asp:TextBox ID="txtZoneGroup" runat="server" MaxLength="10" Width="528px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 174px">
                                                <asp:Label ID="lblDetailLocation" runat="server" Text="DetailLocation"></asp:Label></td>
                                            <td colspan="3">
                                                <asp:TextBox ID="txtDetailLocation" runat="server" MaxLength="100" Width="528px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 174px; height: 24px;">
                                                <asp:Label ID="lblRowNo" runat="server"></asp:Label><em><span style="color: #ff0000">*</span></em>
                                            </td>
                                            <td style="width: 103px; height: 24px;">
                                                <asp:TextBox ID="txtRowNo" runat="server" Width="98px"  MaxLength="5" onblur="RowNoCheck(this);" onkeyup="value=value.replace(/[^\d]/g,'');" ></asp:TextBox>
                                                <%--onblur="CheckCtlNo(this)" onkeydown="javascript:return KeyDown(this)"--%>
                                            </td>
                                            <td style="width: 155px; height: 24px;">
                                                <asp:Label ID="lblSeq" runat="server" Text="Seqw"></asp:Label><em><span style="color: #ff0000">*</span></em>
                                            </td>
                                            <td style="width: 118px; height: 24px">
                                                <asp:TextBox ID="txtSeqNo" runat="server" Width="98px" MaxLength="5" onblur="SeqNoCheck(this);" onkeyup="value=value.replace(/[^\d]/g,'');" ></asp:TextBox>
                                                 <%--onblur="CheckCtlNo(this)" onkeydown="javascript:return KeyDown(this)" --%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 174px; height: 25px">
                                                <asp:Label ID="lblEffectiveFrom" runat="server"></asp:Label><em><span style="color: #ff0000">*</span></em>
                                            </td>
                                            <td style="width: 103px; height: 25px">
                                                <APJ:DateTextBox ID="dtbEffectiveFrom" runat="server"></APJ:DateTextBox>
                                            </td>
                                            <td style="width: 155px; height: 25px">
                                                <asp:Label ID="lblEffectiveTo" runat="server"></asp:Label><em><span style="color: #ff0000">*</span></em>
                                            </td>
                                            <td style="height: 25px; width: 118px;">
                                                <APJ:DateTextBox ID="dtbEffectiveTo" runat="server"></APJ:DateTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 174px">
                                            </td>
                                            <td style="width: 103px">
                                            </td>
                                            <td style="width: 155px">
                                            </td>
                                            <td style="width: 118px">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="4">
                                                <asp:CheckBox ID="chkVoid" runat="server" Text="" TextAlign="Left" /></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                            </td>
                                            <td style="width: 155px">
                                            </td>
                                            <td style="width: 118px">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="4">
                                                <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />
                                                <asp:Button ID="btnSaveAndReturn" runat="server" Text="Save And Return" OnClick="btnSaveAndReturn_Click" />
                                                <asp:Button ID="btnSaveAndNew" runat="server" Text="Save And New" OnClick="btnSaveAndNew_Click" />
                                                <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
                                            </td>
                                        </tr>
                                    </table>
                                </fieldset>
                                <!--**********context End *****************-->
                            </td>
                        </tr>
                        <tr>
                            <td class="Page_Foot" style="height: 54px">
                                <WebStructure:PageFoot ID="PageFoot" runat="server" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
